<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">

function editEmployee(id){
	
	window.open("getEmployee.do?id="+id, "register", 'height=600,width=900');
}



</script>
</head>
<body>
<p style="font-weight: bolder; color: green" align="center">
<%

if(request.getAttribute("createEmployeeSucsess") != null){
	out.print(request.getAttribute("createEmployeeSucsess"));
	request.setAttribute("createEmployeeSucsess", null);
}
if(request.getAttribute("editEmployeeSucsess") != null){
	out.print(request.getAttribute("editEmployeeSucsess"));
	request.setAttribute("editEmployeeSucsess", null);
}
if(request.getAttribute("deleteEmployeeSucsess") != null){
	out.print(request.getAttribute("deleteEmployeeSucsess"));
	request.setAttribute("deleteEmployeeSucsess", null);
}
%>
</p>

<% if(request.getAttribute("from")==null || !((String)request.getAttribute("from")).equalsIgnoreCase("me")){ %>

<table style="COLOR: #004040; FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: 'Verdana'; 
vertical-align: top; border-bottom-style:solid; ; border-bottom-color: gray; 
					border-right-style:solid; ; border-right-color: gray; 
					border-left-style:solid; ; border-left-color: gray; border-top-style:solid; ; border-top-color: gray">
	
		<thead style="BACKGROUND-COLOR: #fbfe70; font-size: " >
			<tr>
			<td colspan="15" align="center" >Employee List
			</td>
		</tr>
			<tr>
				<td>First Name</td>
				<td>Last Name</td>
				<td>Date Of Birth</td>
				<td>Username</td>
				<td >Address Line1</td>
				<td >Address Line2</td>
				<td >City</td>
				<td >State</td>
				<td >Zip</td>
				<td >Work Description</td>
				<td>Hire Date</td>
				<td>Role</td>		
				<td>Position</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				
			</tr>
		</thead>
		<c:if test="${not empty lstEmployees}">
			<c:set var="i" value="1"/>
			<c:forEach items="${lstEmployees}" var="item">
			<c:if test="${i % 2 == 0}">
				<c:set value="BACKGROUND-COLOR: #d6d6d6;" var="style"></c:set>
			</c:if>
			<tr style="${style}">
				<c:set value="" var="style"></c:set>
				
				<td><c:out value="${item.firstName}" /></td>
				<td><c:out value="${item.lastName}" /></td>
				<td><c:out value="${item.dateOfBirth}" /></td>
				<td><c:out value="${item.userName}"></c:out></td>
				<td><c:out value="${item.addressLine1}" /></td>
				<td><c:out value="${item.addressLine2}" /></td>
				<td><c:out value="${item.city}" /></td>
				
				<td><c:out value="${item.state}"></c:out></td>
				<td><c:out value="${item.zip}" /></td>
				<td><c:out value="${item.workDescription}" /></td>
				<td><c:out value="${item.hireDate}" /></td>
				<td><c:out value="${item.role}" /></td>	
				<td><c:out value="${item.position}" /></td>	
				<td><a href="javascript:editEmployee(<c:out value="${item.id}"></c:out>)">Edit</a></td>	
				<td><a href="deleteEmployee.do?id=<c:out value='${item.id}'></c:out>" >Delete</a></td>					
				<c:set var="i" value="${i+1}"/>
			</tr>
			</c:forEach>
		</c:if>
		<c:if test="${empty lstEmployees}">
			<tr>
				<td colspan=15 align="center" style="color:Red; font-size: 11px; font-style: italic;">No Employees available</td>
			</tr>
		</c:if>
	</table>
<%


} request.setAttribute("from", null);%>
</body>
</html>